{#
    manuals.html
    ~~~~~~~~~~~~~~~~~~~~~
    Sphinx sidebar template: "CDAP Manuals" links.
    
    To work around the scoping rules of Jinja, use the "if icons.append('')" construct.
    See http://stackoverflow.com/questions/4870346/can-a-jinja-variables-scope-extend-beyond-in-an-inner-block
#}
{%- set CDAP_DOCS = 'CDAP Documentation' %}
{%- set master_url_root = pathto(master_doc, 1) %}
{%- if master_url_root == '#' %}{% set master_url_root = '' %}{% endif %}
{%- if html_short_title_toc != CDAP_DOCS %}{% set master_url_root =  master_url_root + '/..' %}{%- endif %}
{%- set icons =   [''] + theme_manual_icons %}
{%- set manuals = [''] + theme_manuals %}
{%- set hrefs = [ master_url_root + '/../index.html'] %}
{%- for theme_manual in theme_manuals %}
    {%- if hrefs.append(master_url_root + '/../'+ theme_manual + '/index.html') %}{%- endif %}
{%- endfor %}
{%- set titles =  ['Overview'] + theme_manual_titles %}
{%- for manual, href, title in [('release-notes',     'reference-manual/release-notes.html', 'Release Notes'), 
                                ('glossary',          'reference-manual/glossary.html',      'Glossary'),
                                ('search',            'search.html',                         'Search'),
                                ] %}
    {% if icons.append('') %}{% endif %}
    {% if manuals.append(manual) %}{% endif %}
    {% if hrefs.append(master_url_root + '/../'+ href) %}{% endif %}
    {% if titles.append(title) %}{% endif %}
{%- endfor %}
  <div role="note" aria-label="manuals links">
    <h3><a href="{{ master_url_root }}{{ _('/../index.html') }}" rel="nofollow">{{ CDAP_DOCS }} v{{ version }}</a></h3>
    <ul class="this-page-menu">
    {%- for manual in manuals %}
      {%- set doc = '' %}{% set docb = '' %}
      {%- set title = titles[loop.index0] %}
      {%- if (title == html_short_title_toc) and (pagename == 'index') %}{% set doc = '<b>' %}{% set docb = '</b>' %}{%- endif %}
      {%- if manual == pagename %}{% set doc = '<b>' %}{% set docb = '</b>' %}{%- endif %}
      {%- if loop.first and html_short_title_toc == CDAP_DOCS and pagename == 'index' %}{% set doc = '<b>' %}{% set docb = '</b>' %}{%- endif %}
      <li><div class="{{ icons[loop.index0] }}"></div>{{ doc }}<a href="{{ hrefs[loop.index0] }}" rel="nofollow">{{ title }}</a>{{ docb }}</li>
    {%- endfor %}
    </ul>
  </div>
